package com.itzhanshen.sys.feign;

import com.nineclock.common.entity.Result;
import com.nineclock.dto.SysCompanyUserDTO;
import com.nineclock.dto.SysUserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "sys-service")
public interface SysUserFeign {
    @GetMapping("/user/query")
    public Result<SysUserDTO> findUserInfo(@RequestParam("username") String username);

    // 关于员工信息 //根据用户ID/企业ID动态查询员工列表数据
    @GetMapping("/companyUser/query")
    public Result<List<SysCompanyUserDTO>> findCompanyUserByUserIdAndCompanyId(@RequestParam(value = "userId", required = false) Long userId
            , @RequestParam(value = "companyId", required = false) Long companyId);

    @GetMapping("/companyUser/queryById/{companyUserId}")
    public Result<SysCompanyUserDTO> findCompanyUserById(@PathVariable("companyUserId") Long companyUserId);

    // 获取当前企业所对应的所有部门
    @GetMapping("/organization/findDepartmentByCompanyId")
    public Result<List<Long>> findDepartmentByCompanyId();

    // 获取考勤组下部门的所有员工
    @GetMapping("/organization/findAttendAndCompanyUserCount")
    public Result<Integer> findAttendAndCompanyUserCount(@RequestParam("departmentId") List<Long> departmentId);

    // 获取当前企业所有员工
    @GetMapping("/companyUser/queryAll")
    public Result<List<SysCompanyUserDTO>> queryAllCompanyUsers();

    // 根据员工ID , 依次获取其 所在部门的ID及上层部门ID
    @GetMapping("/organization/findDepartmentIdByCompanyUserId/{companyUserId}")
    public Result<List<Long>> findDepartmentIdByCompanyUserId(@PathVariable("companyUserId") Long companyUserId);

    //根据企业ID查询企业的主管理员信息
    @GetMapping("/queryAdminByCompanyId")
    public Result<SysCompanyUserDTO> queryAdminByCompanyId(Long companyId);
}
